package com.mybatis.plus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.mybatis.plus.mapper.MybatisPlusMapper;
import com.mybatis.plus.pojo.MybatisPlus;
import com.mybatis.plus.service.MybatisPlusService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class MybatisPlusServiceImpl implements MybatisPlusService {

    @Resource
    private MybatisPlusMapper mybatisPlusMapper;

    @Override
    public List<MybatisPlus> findAll() {
        QueryWrapper<MybatisPlus> userQueryWrapper = new QueryWrapper<>();

//        QueryWrapper<MybatisPlus> userQueryWrapper = Wrappers.query(); //和上面一样的效果
//        userQueryWrapper.select("password").eq("username", user.getUsername());

//        Map<String, Object> columnMap = new HashMap<>();
//        columnMap.put("name", "李艺伟");
//        columnMap.put("age", 28);
//        List<MybatisPlus> userList = mybatisPlusMapper.selectByMap(columnMap);

//        List<Long> list = Arrays.asList(1088248166370832385L, 1094590409767661570L, 1209509417456001025L);
//        List<MybatisPlus> userList = mybatisPlusMapper.selectBatchIds(list);

//        lt：less than 小于
//        le：less than or equal to 小于等于
//        eq：equal to 等于
//        ne：not equal to 不等于
//        ge：greater than or equal to 大于等于
//        gt：greater than 大于

        return mybatisPlusMapper.selectList(null);
    }


}
